package com.autonavi.yunda.yunji.job.executor.controller;

import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author cizhong.wcs
 * @date 2021/11/22 3:39 下午
 */
@RestController
public class HealthCheckController {
    @Resource
    private XxlJobSpringExecutor xxlJobSpringExecutor;

    @RequestMapping(path = {"/actuator/health", "/health", "/tmd_status", "/status.taobao"})
    public String checkHealth() {
        return "success";
    }

    @RequestMapping(path = {"/checkAndRefreshExecutorInfo"})
    public String checkAndRefreshExecutorInfo() {
        xxlJobSpringExecutor.initAndRefreshEngineJobHandler();
        return "success";
    }
}
